package cn.iocoder.yudao.module.exam.dal.mysql.question;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.exam.controller.admin.question.vo.QuestionPageReqVO;
import cn.iocoder.yudao.module.exam.dal.dataobject.question.QuestionDO;

/**
 * 试题管理-题目管理 Mapper
 * @author convis
 * @Date 2025/6/9
 */
public interface QuestionMapper extends BaseMapperX<QuestionDO> {
    default PageResult<QuestionDO> selectPage(QuestionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<QuestionDO>()
                .likeIfPresent(QuestionDO::getName, reqVO.getName())
                .eqIfPresent(QuestionDO::getQuestionType, reqVO.getQuestionType())
                .eqIfPresent(QuestionDO::getContent, reqVO.getContent())
                .eqIfPresent(QuestionDO::getDifficulty, reqVO.getDifficulty())
                .orderByDesc(QuestionDO::getId));
    }

}
